﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

using WebSite.DAL;
using WebSite;

namespace WebSite
{
    public partial class CasosPaciente : System.Web.UI.Page
    {
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PacienteDAO.BuscarPacientes(lbListarPacientes.Items);
            }             
        }

        protected void lbListarPacientes_SelectedIndexChanged(object sender, EventArgs e)
        {
            lbListarCasosPaciente.Items.Clear();
            lbListarCasosPaciente.Visible = true;

            CasoPacienteDAO.ListarCasosPacientes(int.Parse(lbListarPacientes.SelectedItem.Value), lbListarCasosPaciente.Items);
        }

        protected void btNovoCaso_OnClick(object sender, EventArgs e)
        {
            if (lbListarPacientes.SelectedItem.Selected)
            {
                Response.Redirect("NovoCaso.aspx?idPaciente=" + lbListarPacientes.SelectedItem.Value);
            }
        }

        protected void btGerarDiagnostico_OnClick(object sender, EventArgs e)
        {
            if (lbListarCasosPaciente.SelectedItem.Selected)
            {               

                Response.Redirect("ResultadoDiagnostico.aspx?CP=" + lbListarCasosPaciente.SelectedItem.Value);

            }
        }

        
        
    }
}